﻿using System.Text;
using CompactMapper.Orm.UnitOfWork.Mappings;

namespace CompactMapper.Orm.UnitOfWork.Commands.Criteria
{
    internal sealed class StringLikeCriterion<T> : Criterion<T>
    {
        private const string Like = " LIKE ";

        public StringLikeCriterion(Queries.Criterion<T> criterion, TablesTree tablesTreeRoot)
            : base(criterion, tablesTreeRoot)
        {
        }

        protected override string ToSql()
        {
            var sql = new StringBuilder()
                .Append(PropertyName)
                .Append(Like)
                .Append("'")
                .Append(TargetValue)
                .Append("'")
                .ToString();
            return sql;
        }

        public override System.Data.SQLite.SQLiteParameter SQLiteParameter()
        {
            return null;
        }
    }
}